﻿using System;
using GalaSoft.MvvmLight;
using HtScrum.Service.Locator;
using HtScrum.Service.Model;
using HtScrum.Service.Repository;

namespace HtScrum.UI.Catalog.Customer.ViewModel
{
    public class CustomerCatalogViewModel : ViewModelBase
    {
        private IRepository<CustomerModel> repository = RepositoryProviderLocator.Current.GetInstance<IRepository<CustomerModel>>();

        public CustomerCatalogViewModel()
        {
            this.Collection = new CustomerDataCollectionViewModel();
            this.LoadData();
        }

        public void LoadData()
        {
            repository.Load((result) =>
            {
                this.Collection.DataCollection = result;
                this.Collection.BindingDate();
            });
        }

        public CustomerDataCollectionViewModel Collection { get; set; }
    }
}